<#include "macro_.ftl">
package ${packageCode}.${moduleMapperCode}.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
<#if entityMapper??>
import ${packageCode}.${moduleMapperCode}.dao.${businessCode}Dao;
import ${packageCode}.${moduleMapperCode}.dto.${businessCode}Dto;
</#if>

/**
 * ${businessName}服务
 *
 * @author ${author!'yaohaitao'}
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class ${businessCode}DefaultService implements ${businessCode}Service {
<#if entityMapper??>
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, ${businessCode}Dto save${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).saveByIdOrCode(mappedClass, save${businessCode});
	}
	
	@Override
	@Transactional
	public ${businessCode}Dto saveByIdOrCode(${businessCode}Dto save${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).saveByIdOrCode(${businessCode}Dto.class, save${businessCode});
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, ${businessCode}Dto find${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).findByCodeOrId(mappedClass, find${businessCode});
	}
	
	@Override
	public Integer readByCodeNqIdForCount(${businessCode}Dto read${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).readByCodeNqIdForCount(read${businessCode});
	}
	
	@Override
	@Transactional
	public int insertByCode(${businessCode}Dto insert${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).insertByCode(insert${businessCode});
	}
	
	@Override
	@Transactional
	public int updateByCode(${businessCode}Dto update${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).updateByCode(update${businessCode});
	}

	@Override
	@Transactional
	public int deleteByIds(${businessCode}Dto delete${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).deleteByIds(delete${businessCode});
	}

	@Override
	public <P> P findById(Class<P> mappedClass, ${businessCode}Dto find${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).findById(mappedClass, find${businessCode});
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, ${businessCode}Dto findList${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).findListByLikeCode(mappedClass, findList${businessCode});
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(${businessCode}Dao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, ${businessCode}Dto pagination${businessCode}) {
		return ContextHolder.getBean(${businessCode}Dao.class).paginationByLikeCode(mappedClass, pagination${businessCode});
	}
</#if>
}